﻿using System;

namespace cal1
{
    class Maths
    {
        public int num1;
        public string symbol;
        public int num2;
        public double content;
        public void Calculate(int num1, string symbol, int num2)
        {
            switch (symbol)
            {
                case "+":
                    content = num1 + num2;
                    Console.WriteLine("计算和的结果为：{0}", content);
                break;
                case "-":
                    content = num1 - num2;
                    Console.WriteLine("计算差的结果为：{0}", content);
                    break;
                case "*":
                    content = num1 * num2;
                    Console.WriteLine("计算积的结果为：{0}", content);
                    break;
                case "/":
                    if (num2 == 0) {
                        Console.WriteLine("出现错误，被除数不能为0！");

                    }
                    else {
                    content = num1 / num2;
                    Console.WriteLine("计算商的结果为：{0}", content);
                    }
                    break;



            }
        }
    }




    class Program
    {
        static void Main(string[] args)
        {
            Maths maths = new Maths();
            Console.WriteLine("这是一个渣渣计算器，只能算加减乘除（悲）");
            Console.WriteLine("请输入第一个数");
            maths.num1 = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("请输入运算符");
            maths.symbol = Console.ReadLine();
            Console.WriteLine("请输入第二个数");
            maths.num2 = Convert.ToInt32(Console.ReadLine());
            maths.Calculate(maths.num1, maths.symbol, maths.num2);
        }
    }
}
